﻿using System;
using System.Collections.Generic;
using System.Text;
using NLBS.Entity;
using NLBS.Data.Business;

namespace NLBS.Views
{
   public class SmilePresenter:Presenter<IFirstContentView,IAction<Smile>>
    {
       public override void OnActionLoaded()
       {
           base.OnActionLoaded();
           this.Action.DataSelectSingle += new EventHandler(Action_DataSelectSingle);
           this.Action.DataInsert += new EventHandler(Action_DataInsert);
           this.Action.DataUpdate += new EventHandler(Action_DataUpdate);
           this.Action.DataDelete += new EventHandler(Action_DataDelete);
       }

       void Action_DataDelete(object sender, EventArgs e)
       {
           SmileData.DeleteSmile(this.Action.keyID);
       }

       void Action_DataUpdate(object sender, EventArgs e)
       {
           SmileData.UpdateSmile(this.Action.Entity);
       }

       void Action_DataSelectSingle(object sender, EventArgs e)
       {
           this.Action.Entity=SmileData.GetSmileByID(this.Action.keyID);
       }

       void Action_DataInsert(object sender, EventArgs e)
       {
           SmileData.InsertSmile(this.Action.Entity);
       }
    }
}
